<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>人员管理--${fns:getConfig('productName')}</title>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/jqGridHead.jsp"%>
</head>
<body>
	<ul class="nav nav-tabs" style="margin:0 4px;margin-bottom:4px;">
		<li class="active"><a href="${ctx}/user/listInfo.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}">
			<i class="icon icon-list"></i>&nbsp;<span>人员列表</span></a></li>
			<sec:authorize ifAnyGranted="ROLE_sys_user_edit" >
		<li><a href="${ctx}/user/input.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}">
		     <i class="icon icon-edit"></i>&nbsp;<span>人员添加</span></a></li>
		   </sec:authorize>  
	</ul>
	<tags:message content="${msg}" />
	<form id="mainForm"  role="form" method="get">
		<div class="breadcrumb form-search" style="background-color: #f5f5f5;">
			<div>
				<label>关键字:</label>
				<input type="text"  name="filter_LIKES_name_OR_username_OR_email" placeholder="姓名或登录名或邮箱关键字"  oninput="queryForGrid('mainForm','jqGrid')" onporpertychange="queryForGrid('mainForm','jqGrid')"/>
			</div>
		</div>
	
	<table id="jqGrid"></table>
	<div id="jqGridPager"></div>
	</form>

	<script type="text/javascript">
		$(document).ready(function()
		{
			var jqgridH = $(window).height()-350;
			$("#jqGrid").jqGrid(
			{ url : '${ctx}/user/list.do',
			  mtype : "GET",
			  datatype : "json",
			  page : 1,
			  viewrecords: true,
			  colModel :
			[<sec:authorize ifAnyGranted="ROLE_sys_user_edit" >
					{ label : "操作", name : "id", 
					  width : 120,   align : 'center', sortable : false, search : false ,
					  classes:'ui-jqgrid-optClass',
					  formatter: function (cellValue, options, rowObject){
	                    	return "<a href='${ctx}/user/input.do?id=" + cellValue + "&top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}' class='underline'><i class='glyphicon glyphicon-edit'></i>修改</a>"+
	                        "<a href='${ctx}/user/delete.do?id="+ cellValue +"&top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}' onclick='return confirm(\"确认要删除该记录吗？\", this.href)' ><i class='icon icon-remove'></i>删除</a>";
					  }
	                    },</sec:authorize>  
					{ label : '姓　名', name : 'name', align : 'center', width : 150},
					{ label : '登录名', name : 'username', align : 'center', width :150},
					{ label : '性别', name : 'sex', align : 'center', width : 120,code:1001,formatter:'codeName'},
					{ label : '电话', name : 'mobilePhone', align : 'center', width : 120 },
					{ label : '邮箱', name : 'email', align : 'center', width : 180},
					{ label : '岗位职责', name : 'dutyName', align : 'center', width : 150},
					{ label : '单位', name : 'org.orgName', align : 'center', width : 100}
			], autowidth : false,width:$(window).width()-245, height : jqgridH,scrollOffset:0, shrinkToFit : 400, rowNum : 10, viewrecords : true, rownumbers : true,
			jsonReader:{
    			root: "result",
    			page: "currentPage",
    			total: "totalPages",
    			records: "totalCount",
    			repeatitems: true,
    			cell: "cell",
    			id: "id",
    			userdata: "userdata",
    			subgrid: {root:"results", repeatitems: true, cell:"cell"}
    		},
    		prmNames: {
				page:"pageNo",
				rows:"pageSize",
				sort: "orderBy",
				order: "order",
				search:"_search",
				nd:"nd", id:"id",
				oper:"oper",
				editoper:"edit",
				addoper:"add",
				deloper:"del",
				subgridid:"id",
				npage: null,
				totalrows:"totalCounts"
			}, 
			rowList :[10,20,30], 
			pager : "#jqGridPager"
			});
			
			 $('#jqGrid').navGrid("#jqGridPager", {                
	                search: false, // show search button on the toolbar
	                searchtext:'搜索',
	                add: false,
	                edit: false,
	                del: false,
	                refresh: false,
	                refreshtext:'刷新'
	            },
	            {}, // edit options
	            {}, // add options
	            {}, // delete options
	            { multipleSearch: true,multipleGroup: true} // search options - define multiple search
	            );

			$("#jqGrid").jqGrid('setGroupHeaders',
			{ useColSpanStyle : true, // 没有表头的列是否与表头列位置的空单元格合并
				});
			$("#searchmodfbox_jqGrid").css("width", "660px");
		});
	</script>
</body>
</html>